perm filename MIXLOK[MIX,SYS]1 blob
sn#020794 filedate 1972-01-18 generic text, type T, neo UTF8
00100 COMMENT ⊗ MIXLOK is the section that has the stuff do handle
00200 the i/o interlocking. Basically, there are four
00300 subroutines: RLOCK, WLOCK, RRLOCK, WWLOCK. R and W
00400 assume a memory address (relative to MC0000) in MLOCK and skip
00500 if that address may be Read or Written. RR and LL
00600 assume a range, with first address in the left half
00700 of MLOCK and the last address in the right half, and
00800 skip if every address in that range may be Read or Written.
00900 ⊗
01000
01100
01200
01300 MLOCK: 0 ; contains memory location (or range) under consideration
01400
01500 RLOCKT: ; table of devices which lock out a read attempt
01600 CRDLOK: -1
01700 0
01800 0
01900 TINLOK: -1
02000 0
02100 0
02200 0
02300
02400 WLOCKT: ; table of devices which lock out a write attempt
02500 CPNLOK: -1
02600 0
02700 0
02800 PRNLOK: -1
02900 0
03000 0
03100 TOTLOK: -1
03200 0
03300 0
03400 0
03500
03600 OPDEF RLOCK [PUSHJ P, .]
03700 SKIPA 11, [RLOCKT]
03800
03900 OPDEF WLOCK [PUSHJ P, .]
04000 MOVEI 11, WLOCKT
04100
04200 LOCK: MOVE 10, (11) ; first entry is the value of EXTIME when the device is ready
04300 CAMG 10, EXTIME ; has this time happened yet?
04400 JRST LOKOK ; yes → this device doesn't lock us out
04500 MOVE 10, MLOCK ; this is the address under consideration
04600 CAML 10, (11) 1 ; does it come before first address in busy-range
04700 CAMLE 10, (11) 2 ; or after the last?
04800 JRST LOKOK ; yes → then we aren't locked out
04900 POPJ P, ; no → this device won't let us use this address
05000 LOKOK: ADDI 11, 3 ; go to next device in table
05100 SKIPE (11) ; zero → no more devices
05200 JRST LOCK ; go back for next device
05300 AOS (P) ; no more devices → we can use this address
05400 POPJ P, ; so skip on return
05500
05600
05700 OPDEF RRLOCK [PUSHJ P, .]
05800 SKIPA 11, [RLOCKT]
05900
06000 OPDEF WWLOCK [PUSHJ P, .]
06100 MOVEI 11, WLOCKT
06200
06300 LLOCK: MOVE 10, (11) ; check on EXTIME for this device
06400 CAMG 10, EXTIME
06500 JRST LLOKOK ; device isn't busy
06600 HLRZ 10, MLOCK ; check first address in range
06700 CAML 10, (11) 2 ; is it higher than last locked-out address?
06800 JRST LLOKOK ; yes → we're OK
06900 HRRZ 10, MLOCK ; check last address in range
07000 CAMG 10, (11) 1 ; is it lower than last locked-out address?
07100 JRST LLOKOK ; yes → we're OK
07200 POPJ P, ; no → some address in range is locked out
07300 LLOKOK: ADDI 11, 3 ; check next device
07400 SKIPE (11) ; zero → no devices left
07500 JRST LLOCK ; go back and check this device
07600 AOS (P) ; no devices left → we can use this range
07700 POPJ P, ; so skip on return